package com.lzt.yijian.mvp.view.activity;

import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;

import com.lzt.yijian.R;
import com.lzt.yijian.mvp.base.BaseActivity;
import com.lzt.yijian.mvp.presenter.SplashPresenterImpl;

import butterknife.BindView;
import butterknife.OnClick;

public class SplashActivity extends BaseActivity implements SplashView {

    @BindView(R.id.splash_skip_time)
    TextView mSplashSkipTime;
    private SplashPresenterImpl mISplashPresenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_splash);

        mISplashPresenter = new SplashPresenterImpl(this);
        mISplashPresenter.onCheckLogin(this);
    }

    @Override
    public void onDownTimeDone(String skip) {
        mSplashSkipTime.setText(skip);
    }

    @Override
    public void onCheckLoginDone(boolean isLogin) {
        finish();
        if (isLogin) {
            startActivity(new Intent(this, MainActivity.class));
        }
    }

    @OnClick(R.id.splash_skip_time)
    public void onViewClicked() {
        startActivity(new Intent(this, MainActivity.class));
    }
}
